import { useRef } from "react"
import echarts from 'echarts'


export default function Chart(props){
  // todo:props 默认值
  // eslint-disable-next-line react/prop-types
  const {data} = props
  const targetRef = useRef(null)
  let chartInstance = null

  function init(){
    chartInstance = echarts.init(targetRef.current)
    chartInstance.setOption(data)
  }

  function autoResize (){

  }

  // mounted????
  init()
  autoResize()
  
  return <div ref={targetRef}></div>
}